import Vue from "vue";
import Router from 'vue-router'

Vue.use(Router)

const login = r => require.ensure([], () => r(require('@/page/login')), 'login');
const home = r => require.ensure([], () => r(require('@/page/home')), 'home');
const manage = r => require.ensure([], () => r(require('@/page/manage')), 'manage');
const newGame = r => require.ensure([], () => r(require('@/page/game')), 'game');
const exerciseNum = r => require.ensure([], () => r(require('@/page/exerciseNum')), 'exerciseNum');
const exercisePage1 = r => require.ensure([], () => r(require('@/page/exercisePage1')), 'exercisePage1');
const exercisePage2 = r => require.ensure([], () => r(require('@/page/exercisePage2')), 'exercisePage2');
const exercisePage3 = r => require.ensure([], () => r(require('@/page/exercisePage3')), 'exercisePage3');
const selectScale = r => require.ensure([], () => r(require('@/page/selectScale')), 'selectScale');
const selectExercise1 = r => require.ensure([], () => r(require('@/page/selectExercise1')), 'selectExercise1');
const selectExercise2 = r => require.ensure([], () => r(require('@/page/selectExercise2')), 'selectExercise2');
const explain = r => require.ensure([], () => r(require('@/page/explain')), 'explain');

export default new Router({
    routes: [
        {
            path: '/',
            component: login
        },
        {
            path: '/manage',
            component: manage,
            children: [
                {
                    path: '',
                    component: home,
                },
                {
                    path: '/newGame',
                    component: newGame,
                },
                {
                    path: '/exerciseNum',
                    component: exerciseNum,
                    meta: ['做题量', '数据']
                },
                {
                    path: '/exercisePage1',
                    component: exercisePage1,
                    meta: ['题目', '列表']
                },
                {
                    path: '/exercisePage2',
                    component: exercisePage2,
                    meta: ['题目', '列表']
                },
                {
                    path: '/exercisePage3',
                    component: exercisePage3,
                    meta: ['题目', '列表']
                },
                {
                    path: '/selectExercise1/:index',
                    name: 'selectExercise1',
                    meta: ['题目', '列表'],
                    component: selectExercise1,
                },
                {
                    path: '/selectExercise2/:index',
                    name: 'selectExercise2',
                    meta: ['题目', '列表'],
                    component: selectExercise2,
                },
                {
                    path: '/selectScale',
                    component: selectScale,
                },
                {
                    path: '/explain',
                    component: explain,
                    meta: ['说明']
                }
            ]
        }
    ]
    }
)
